

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>2. Getting Started &mdash; LIGGGHTS v3.X documentation</title>
  

  
  
  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  

  
    <link rel="top" title="LIGGGHTS v3.X documentation" href="index.html"/>
        <link rel="next" title="3. Input Script" href="Section_input_script.html"/>
        <link rel="prev" title="1. Introduction" href="Section_intro.html"/> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="Manual.html" class="icon icon-home"> LIGGGHTS
          

          
          </a>

          
            
            
              <div class="version">
                v3.X
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="Section_intro.html">1. Introduction</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">2. Getting Started</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#how-to-obtain-liggghts-r-public">2.1. How to obtain LIGGGHTS(R)-PUBLIC</a></li>
<li class="toctree-l2"><a class="reference internal" href="#making-liggghts-r-public">2.2. Making LIGGGHTS(R)-PUBLIC</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#read-this-first">2.2.1. <strong>Read this first:</strong></a></li>
<li class="toctree-l3"><a class="reference internal" href="#steps-to-build-a-liggghts-r-public-executable">2.2.2. <strong>Steps to build a LIGGGHTS(R)-PUBLIC executable:</strong></a></li>
<li class="toctree-l3"><a class="reference internal" href="#advanced-building-using-custom-makefiles">2.2.3. <strong>Advanced building using custom makefiles</strong></a></li>
<li class="toctree-l3"><a class="reference internal" href="#errors-that-can-occur-when-making-liggghts-r-public">2.2.4. <strong>Errors that can occur when making LIGGGHTS(R)-PUBLIC:</strong></a></li>
<li class="toctree-l3"><a class="reference internal" href="#additional-build-tips">2.2.5. <strong>Additional build tips:</strong></a></li>
<li class="toctree-l3"><a class="reference internal" href="#building-for-a-mac">2.2.6. <strong>Building for a Mac:</strong></a></li>
<li class="toctree-l3"><a class="reference internal" href="#building-for-windows">2.2.7. <strong>Building for Windows:</strong></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#making-liggghts-r-public-with-optional-packages">2.3. Making LIGGGHTS(R)-PUBLIC with optional packages</a></li>
<li class="toctree-l2"><a class="reference internal" href="#building-liggghts-r-public-via-the-make-py-script">2.4. Building LIGGGHTS(R)-PUBLIC via the Make.py script</a></li>
<li class="toctree-l2"><a class="reference internal" href="#building-liggghts-r-public-as-a-library">2.5. Building LIGGGHTS(R)-PUBLIC as a library</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#static-library">2.5.1. <strong>Static library:</strong></a></li>
<li class="toctree-l3"><a class="reference internal" href="#shared-library">2.5.2. <strong>Shared library:</strong></a></li>
<li class="toctree-l3"><a class="reference internal" href="#additional-requirement-for-using-a-shared-library">2.5.3. <strong>Additional requirement for using a shared library:</strong></a></li>
<li class="toctree-l3"><a class="reference internal" href="#calling-the-liggghts-r-public-library">2.5.4. <strong>Calling the LIGGGHTS(R)-PUBLIC library:</strong></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#running-liggghts-r-public">2.6. Running LIGGGHTS(R)-PUBLIC</a></li>
<li class="toctree-l2"><a class="reference internal" href="#command-line-options">2.7. Command-line options</a></li>
<li class="toctree-l2"><a class="reference internal" href="#liggghts-r-public-screen-output">2.8. LIGGGHTS(R)-PUBLIC screen output</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="Section_input_script.html">3. Input Script</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_commands.html">4. Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_gran_models.html">5. Contact models</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_mesh_modules.html">6. Mesh modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_packages.html">7. Packages</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_howto.html">8. How-to discussions</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_modify.html">9. Modifying &amp; extending LIGGGHTS(R)-PUBLIC</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_python.html">10. Python interface to LIGGGHTS(R)-PUBLIC</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_errors.html">11. Errors</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="Manual.html">LIGGGHTS</a>
        
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="Manual.html">Docs</a> &raquo;</li>
        
      <li>2. Getting Started</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/Section_start.txt" rel="nofollow"> View page source</a>
          
          <a href="http://www.cfdem.com"> Website</a>
          
            <a href="Section_commands.html#comm" rel="nofollow"> Commands</a>
            
          
        
      </li>
    
  </ul>

  
  <hr/>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="Section_input_script.html" class="btn btn-neutral float-right" title="3. Input Script" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="Section_intro.html" class="btn btn-neutral" title="1. Introduction" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="getting-started">
<h1>2. Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline">¶</a></h1>
<p>This section describes how to build and run LIGGGHTS(R)-PUBLIC, for both new and
experienced users.</p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#how-to-obtain-liggghts-r-public" id="id11">How to obtain LIGGGHTS(R)-PUBLIC</a></li>
<li><a class="reference internal" href="#making-liggghts-r-public" id="id12">Making LIGGGHTS(R)-PUBLIC</a></li>
<li><a class="reference internal" href="#making-liggghts-r-public-with-optional-packages" id="id13">Making LIGGGHTS(R)-PUBLIC with optional packages</a></li>
<li><a class="reference internal" href="#building-liggghts-r-public-via-the-make-py-script" id="id14">Building LIGGGHTS(R)-PUBLIC via the Make.py script</a></li>
<li><a class="reference internal" href="#building-liggghts-r-public-as-a-library" id="id15">Building LIGGGHTS(R)-PUBLIC as a library</a></li>
<li><a class="reference internal" href="#running-liggghts-r-public" id="id16">Running LIGGGHTS(R)-PUBLIC</a></li>
<li><a class="reference internal" href="#command-line-options" id="id17">Command-line options</a></li>
<li><a class="reference internal" href="#liggghts-r-public-screen-output" id="id18">LIGGGHTS(R)-PUBLIC screen output</a></li>
</ul>
</div>
<div class="section" id="how-to-obtain-liggghts-r-public">
<span id="start-1"></span><h2><a class="toc-backref" href="#id11">2.1. How to obtain LIGGGHTS(R)-PUBLIC</a><a class="headerlink" href="#how-to-obtain-liggghts-r-public" title="Permalink to this headline">¶</a></h2>
<p>We recommend to use git to download the LIGGGHTS(R)-PUBLIC package. Make sure that the
<em>git</em> command is available on your system. On a Ubuntu/Debian box this can be
achieved by</p>
<div class="highlight-python"><div class="highlight"><pre>sudo apt-get install git
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Users of a LIGGGHTS-PREMIUM version will need to replace the
LIGGGHTS-PUBLIC strings shown below by their respective version string. This
string is equal to LIGGGHTS(R)-PUBLIC without the &#8220;(R)&#8221;.</p>
</div>
<p>LIGGGHTS(R)-PUBLIC can then be downloaded by typing</p>
<div class="highlight-python"><div class="highlight"><pre>git clone git@github.com:CFDEMproject/LIGGGHTS-PUBLIC.git
</pre></div>
</div>
<p>Under certain circumstances (e.g. company firewall) this might fail and instead
you can use</p>
<div class="highlight-python"><div class="highlight"><pre>git clone https://github.com/CFDEMproject/LIGGGHTS-PUBLIC.git
</pre></div>
</div>
<p>to obtain LIGGGHTS(R)-PUBLIC. The advantage of using one of these two commands is that
you can use</p>
<div class="highlight-python"><div class="highlight"><pre>git pull
</pre></div>
</div>
<p>to easily fetch the latest version of the code when we release a new version.
Note that this command needs to be executed in your LIGGGHTS-PUBLIC folder.</p>
<p>If none of the clone commands work you can download the package
<a class="reference external" href="https://github.com/CFDEMproject/LIGGGHTS-PUBLIC/archive/master.zip">here</a>
without having to use git. Note that <em>git pull</em> will not work in this case,
instead you will have to download the full zip file again.</p>
<p>The LIGGGHTS-PUBLIC directory contains two files and several directories:</p>
<table border="1" class="docutils">
<colgroup>
<col width="16%" />
<col width="84%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>README</td>
<td>text file</td>
</tr>
<tr class="row-even"><td>LICENSE</td>
<td>the GNU General Public License (GPL)</td>
</tr>
<tr class="row-odd"><td>doc</td>
<td>documentation</td>
</tr>
<tr class="row-even"><td>examples</td>
<td>simple test problems</td>
</tr>
<tr class="row-odd"><td>lib</td>
<td>libraries LIGGGHTS(R)-PUBLIC can be linked with</td>
</tr>
<tr class="row-even"><td>python</td>
<td>Python wrapper on LIGGGHTS(R)-PUBLIC as a library</td>
</tr>
<tr class="row-odd"><td>src</td>
<td>source files</td>
</tr>
</tbody>
</table>
<hr class="docutils" />
</div>
<div class="section" id="making-liggghts-r-public">
<span id="start-2"></span><h2><a class="toc-backref" href="#id12">2.2. Making LIGGGHTS(R)-PUBLIC</a><a class="headerlink" href="#making-liggghts-r-public" title="Permalink to this headline">¶</a></h2>
<p>This section has the following sub-sections:</p>
<ul class="simple">
<li><a class="reference internal" href="#start-2-1"><span>Read this first</span></a></li>
<li><a class="reference internal" href="#start-2-2"><span>Steps to build a LIGGGHTS(R)-PUBLIC executable</span></a></li>
<li><a class="reference internal" href="#start-2-2-expert"><span>Advanced building using custom makefiles</span></a></li>
<li><a class="reference internal" href="#start-2-3"><span>Common errors that can occur when making LIGGGHTS(R)-PUBLIC</span></a></li>
<li><a class="reference internal" href="#start-2-4"><span>Additional build tips</span></a></li>
<li><a class="reference internal" href="#start-2-5"><span>Building for a Mac</span></a></li>
<li><a class="reference internal" href="#start-2-6"><span>Building for Windows</span></a></li>
</ul>
<hr class="docutils" />
<div class="section" id="read-this-first">
<span id="start-2-1"></span><h3>2.2.1. <strong>Read this first:</strong><a class="headerlink" href="#read-this-first" title="Permalink to this headline">¶</a></h3>
<p>Building LIGGGHTS(R)-PUBLIC can be non-trivial.  You may need to edit a makefile,
there are compiler options to consider, additional libraries can be
used (MPI, FFT, JPEG, PNG), LIGGGHTS(R)-PUBLIC packages may be included or
excluded, some of these packages use auxiliary libraries which need to
be pre-built, etc.</p>
<p>Please read this section carefully.  If you are not comfortable with
makefiles, or building codes on a Unix platform, or running an MPI job
on your machine, please find a local expert to help you.  Many
compiling, linking, and run problems that users have are often not
LIGGGHTS(R)-PUBLIC issues - they are peculiar to the user&#8217;s system, compilers,
libraries, etc.  Such questions are better answered by a local expert.</p>
<p>If you have a build problem that you are convinced is a LIGGGHTS(R)-PUBLIC issue
(e.g. the compiler complains about a line of LIGGGHTS(R)-PUBLIC source code), then
please post a question to the <a class="reference external" href="http://www.cfdem.com/forum">LIGGGHTS(R)-PUBLIC forum</a>.</p>
<p>If you succeed in building LIGGGHTS(R)-PUBLIC on a new kind of machine, for which
there isn&#8217;t a similar Makefile for in the src/MAKE directory, send it
to the developers and we can include it in the LIGGGHTS(R)-PUBLIC distribution. In
particular, we are interested in cases where Makefile.auto does not work, so
that we can improve its performance.</p>
<hr class="docutils" />
</div>
<div class="section" id="steps-to-build-a-liggghts-r-public-executable">
<span id="start-2-2"></span><h3>2.2.2. <strong>Steps to build a LIGGGHTS(R)-PUBLIC executable:</strong><a class="headerlink" href="#steps-to-build-a-liggghts-r-public-executable" title="Permalink to this headline">¶</a></h3>
<p>With LIGGGHTS version 3.5.1 we have rolled out a all new and magic
Makefile.auto which hopefully will make building LIGGGHTS as simple as
possible. If the following steps do not work for you please see the advanced
building description <a class="reference internal" href="#start-2-2-expert"><span>here</span></a>.</p>
<p>Before attempting a build ensure that your system has all required prerequisites
installed. A solid basis for several popular operating systems are listed below:</p>
<div class="highlight-python"><div class="highlight"><pre>Ubuntu 16.04LTS:
  sudo apt-get install openmpi-bin libopenmpi-dev libvtk6.2 libvtk6-dev
-----
Ubuntu 17.10:
  sudo apt-get install openmpi-bin libopenmpi-dev libvtk6.3 libvtk6-dev
-----
Fedora 25:
  su -
  dnf install openmpi openmpi-devel paraview-openmpi paraview-openmpi-devel gcc-c++
  exit
  echo &quot;export PATH=$PATH:/usr/lib64/openmpi/bin&quot; &gt;&gt; ~/.bashrc
  echo &quot;export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib64/openmpi/lib:/usr/lib64/openmpi/lib/paraview&quot; &gt;&gt; ~/.bashrc
  echo &quot;export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/openmpi/lib:/usr/lib64/openmpi/lib/paraview&quot; &gt;&gt; ~/.bashrc
  echo &quot;export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/lib64/openmpi/include/paraview&quot; &gt;&gt; ~/.bashrc
  echo &quot;export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/lib64/openmpi/include/paraview&quot; &gt;&gt; ~/.bashrc
</pre></div>
</div>
<p><strong>Step 0</strong></p>
<p>The src directory contains the C++ source and header files for LIGGGHTS(R)-PUBLIC.
It also contains a top-level Makefile and a MAKE sub-directory with
several Makefile.* files for many machines.  From within the src
directory, type &#8220;make&#8221; or &#8220;gmake&#8221;.  You should see a list of available
choices. Of particular interest is the auto option, as it should do all the
heavy lifting for us. So start by typing</p>
<div class="highlight-python"><div class="highlight"><pre>make auto
</pre></div>
</div>
<p>into the command line. If you are running this for the first time you will see
the following message:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">WARNING</span> <span class="o">&lt;&lt;&lt;</span>
<span class="go">Created MAKE/Makefile.user for the first time. Please check that the options</span>
<span class="go">in that file are set correctly and run make again.</span>
</pre></div>
</div>
<p>That is perfectly normal as <em>MAKE/Makefile.user</em> does not exist by default
and contains some default options. The compilation will continue and if you are
lucky enough it will actually produce an executable called <em>lmp_auto</em> in your
<em>src/</em> folder. If this is the case you are done and can move on to <a class="reference internal" href="#start-6"><span>Running LIGGGHTS(R)-PUBLIC</span></a></p>
<p>Should the compilation interupt please carefully study the error message. The
following procedure will explain how to set compilation variables for <em>make
auto</em>.</p>
<p><strong>Step 1</strong></p>
<p>To configure these options open <em>MAKE/Makefile.user</em> with your favourite
text editor. There are two sections in this file. The first one specifies
which options and features in LIGGGHTS(R)-PUBLIC you would like to activate. The first
three lines are related to MPI and read:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c1"># MPI: &quot;ON&quot; or &quot;OFF&quot;</span>
<span class="c1"># Description: Use the message passing interface for parallel execution</span>
<span class="n">USE_MPI</span> <span class="o">=</span> <span class="s2">&quot;ON&quot;</span>
</pre></div>
</div>
<p>The first, commented line indicates that either &#8220;ON&#8221; or &#8220;OFF&#8221; are valid
parameters of the variable called <em>USE_MPI</em>. A short description of the
option follows and the last line actually sets the option to &#8220;ON&#8221;. The
default <em>MAKE/Makefile.user</em> comes with some sensibly set defaults. So you
might not need to change anything at all.</p>
<p>The second part of this file is by default all commented out and deals with
user and machine specific paths. Say that <em>USE_VTK</em> is set to &#8220;ON&#8221; and your
VTK installation is not in your <em>/usr</em> path, but in <em>/home/liggghts/vtk</em>. In
that case have a look at the following lines:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c1"># VTK specific variables</span>
<span class="c1">#</span>
<span class="c1"># Path that contains the includes (vtkVersion.h)</span>
<span class="c1">#VTK_INC_USR=-I/path/to/vtk/include</span>
<span class="c1"># Path that contains the VTK libraries</span>
<span class="c1">#VTK_LIB_USR=-L/path/to/vtk/lib</span>
<span class="c1"># Additional VTK libraries to include</span>
<span class="c1">#VTK_ADDLIBS_USR=</span>
</pre></div>
</div>
<p>In this case you would want to change <em>VTK_INC_USR</em> and <em>VTK_LIB_USR</em> so
that they become</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c1"># VTK specific variables</span>
<span class="c1">#</span>
<span class="c1"># Path that contains the includes (vtkVersion.h)</span>
<span class="n">VTK_INC_USR</span><span class="o">=-</span><span class="n">I</span><span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">liggghts</span><span class="o">/</span><span class="n">vtk</span><span class="o">/</span><span class="n">include</span>
<span class="c1"># Path that contains the VTK libraries</span>
<span class="n">VTK_LIB_USR</span><span class="o">=-</span><span class="n">L</span><span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">liggghts</span><span class="o">/</span><span class="n">vtk</span><span class="o">/</span><span class="n">lib</span>
<span class="c1"># Additional VTK libraries to include</span>
<span class="c1">#VTK_ADDLIBS_USR=</span>
</pre></div>
</div>
<p>Note that the two lines were uncommented and their values were changed as
required. You can also see that include paths (normally containing <em>INC</em> in
the variable name) need to be prefixed with -I and library paths (containing
<em>LIB</em>) with -L. If you have non-standard paths, this can be a bit tricky to
set up, so if you need any help ask a local expert that knows the setup of
your machine.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you set a <em>_USR</em> variable, such as <em>VTK_INC_USR</em> and its
corresponding non-<em>_USR</em> variable (<em>VTK_INC</em> in our example) is set. Then
the first will have no effect, as the non-<em>_USR</em> variable will have
precedence.</p>
</div>
<p>If you run <em>make auto</em> the Makefile will automatically check if the options
you have provided are valid. It will hopefully supply you with helpful error
messages in case some options cannot be found.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you change any options in the first part of your
<em>MAKE/Makefile.auto</em> after a first compilation you will be requested to
perform a <em>make clean-auto</em> to do a full recompilation of the code.</p>
</div>
<p><strong>Step 2</strong></p>
<p>After all options are set to your satisfaction. Simply run</p>
<div class="highlight-python"><div class="highlight"><pre>make auto
</pre></div>
</div>
<p>again to test the options and compile LIGGGHTS(R)-PUBLIC. After the compilation is
finished you will obtain a executable name <em>lmp_auto</em> and you can continue
<a class="reference internal" href="#start-6"><span>here</span></a>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Should the compilation not work due to some deficiency of the
<em>Makefile.auto</em> that cannot be solved by adjusting <em>MAKE/Makefile.user</em>,
then continue reading to see how to make a custom Makefile for your machine.
If you want to help us, then please send us your finished Makefile via the
<a class="reference external" href="http://www.cfdem.com/forum">forums</a> so that we can improve it for future
use.</p>
</div>
<hr class="docutils" />
<p>For most users it will be convenient if they are able to run LIGGGHTS(R)-PUBLIC by
simply typing <em>liggghts</em> on the command line. To make this possible we need to
create a symbolic link. So after the compilation is complete and your lmp_auto
executable was created you can run the following command to create a system-wide
link:</p>
<div class="highlight-python"><div class="highlight"><pre>sudo ln -s lmp_auto /usr/local/bin
</pre></div>
</div>
<p>Since <em>sudo</em> is not available on all systems (e.g. Fedora) you can alternatively
try:</p>
<div class="highlight-python"><div class="highlight"><pre>su -c &quot;ln -s lmp_auto /usr/local/bin&quot;
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">You need administrator access to run the two commands listed above.</p>
</div>
<p><strong>Step 3 (Advanced usage)</strong></p>
<p>Makefile.auto accepts up to two variables as additional input which are called
<em>debug</em> and <em>postfix</em>. The former variable can be useful when debugging
LIGGGHTS(R)-PUBLIC and can be used by typing</p>
<div class="highlight-python"><div class="highlight"><pre>make auto debug=ON
</pre></div>
</div>
<p>The arguments that can be passed to the debug variable are &#8220;ON&#8221; and &#8220;FULL&#8221;.
This has the same effect as changing the <em>USE_DEBUG</em> variable inside your
<em>Makefile.user</em> to &#8220;ON&#8221; and &#8220;FULL&#8221;, respectively. I.e. with &#8220;ON&#8221; a optimized
debug version of the code is produced, whereas with &#8220;FULL&#8221; a unoptimized
version of the is compiled. The latter can be quite useful when using a debugger
to look at the local variables inside a code fragment.</p>
<p>When using a debug variable the executables will be called either
<em>lmp_auto-debug</em> or <em>lmp_auto-fulldebug</em> for &#8220;ON&#8221; and &#8220;FULL&#8221;, respectively.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you want to clean this particular compilation <em>make clean-auto</em>
also needs to have <em>debug=ON</em> or <em>debug=FULL</em> appended.</p>
</div>
<p>The latter variable <em>postfix</em> can be used by typing</p>
<div class="highlight-python"><div class="highlight"><pre>make auto postifx=myString
</pre></div>
</div>
<p>In this case Makefile.auto will not look for the <em>MAKE/Makefile.user</em> file,
but <em>MAKE/Makefile.user_myString</em>. If it does not exist it will clone
<em>MAKE/Makefile.user</em> (instead of a default template). The resulting
executable will be called <em>lmp_auto_myString</em> (instead of <em>lmp_auto</em>).</p>
<p>The use of the postfix variable should not be required under normal development.
It allows advanced developers to have executables with different features
enabled or disabled and based upon the default <em>Makefile.user</em>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you want to clean this particular compilation <em>make clean-auto</em>
also needs to have <em>postfix=myString</em> appended.</p>
</div>
<p>All model combination of LIGGGHTS(R)-PUBLIC are automatically available starting with
version 3.7. However, only a subset of them are compiled in an optimized manner.
This might give you performance losses between 5 and 20%. In case you are using
a model combination that is not optimized, LIGGGHTS(R)-PUBLIC will notify you of this.
In this case you can create a file called <em>style_contact_model_user.whitelist</em>
in your LIGGGHTS(R)-PUBLIC <em>src/</em> folder and fill it with entries such as</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">GRAN_MODEL</span><span class="p">(</span><span class="n">HERTZ</span><span class="p">,</span> <span class="n">TANGENTIAL_OFF</span><span class="p">,</span> <span class="n">COHESION_OFF</span><span class="p">,</span> <span class="n">ROLLING_OFF</span><span class="p">,</span> <span class="n">SURFACE_DEFAULT</span><span class="p">)</span>
<span class="n">GRAN_MODEL</span><span class="p">(</span><span class="n">HERTZ</span><span class="p">,</span> <span class="n">TANGENTIAL_HISTORY</span><span class="p">,</span> <span class="n">COHESION_OFF</span><span class="p">,</span> <span class="n">ROLLING_EPSD</span><span class="p">,</span> <span class="n">SURFACE_DEFAULT</span><span class="p">)</span>
</pre></div>
</div>
<p>After creating or modifying such a file with the appropriate entries you will need to
recompile LIGGGHTS(R)-PUBLIC and this time it will be built with optimized model
combinations specified in this file.</p>
<p>In addition you can automatically scan files or folders recursively for
LIGGGHTS(R)-PUBLIC input scripts and search them for their used contact model.
With this list an addition to the whitelist is automatically created.
Running the following commands within the LIGGGHTS(R)-PUBLIC src directory</p>
<div class="highlight-python"><div class="highlight"><pre>./genAutoExamplesWhitelist.sh -h
./genAutoExamplesWhitelist.sh ../examples
</pre></div>
</div>
<p>The first will display the help message for genAutoExamplesWhitelist.sh.
The second will recursively search the examples folder of your LIGGGHTS(R)-PUBLIC
installation and scan all in.* files for the used contact models. It will
also create the file <em>style_contact_model_autoExamples.whitelist</em> containing
the unique used models in the whitelist format.</p>
<p>A third whitelist is automatically created during the compilation and is
stored in <em>style_contact_model.whitelist</em> . If this file exists, the next
compilation will NOT change this file. You can manually delete it and
recreate it with</p>
<div class="highlight-python"><div class="highlight"><pre>sh Make.sh models
sh Make.sh models_full
</pre></div>
</div>
<p>During every compilation the three whitelist files <em>style_contact_model_user.whitelist</em> ,
<em>style_contact_model_autoExamples.whitelist</em> and <em>style_contact_model.whitelist</em> are
automatically merged and only unique entries are kept in the merged file.</p>
<hr class="docutils" />
</div>
<div class="section" id="advanced-building-using-custom-makefiles">
<span id="start-2-2-expert"></span><h3>2.2.3. <strong>Advanced building using custom makefiles</strong><a class="headerlink" href="#advanced-building-using-custom-makefiles" title="Permalink to this headline">¶</a></h3>
<p><strong>Step 0</strong></p>
<p>The src directory contains the C++ source and header files for LIGGGHTS(R)-PUBLIC.  It
also contains a top-level Makefile and a MAKE sub-directory with low-level
Makefile.* files for a few selected platforms.  From within the src directory,
type &#8220;make&#8221; or &#8220;gmake&#8221;.  You should see a list of available choices.  If one of
those is the machine and options you want, you can type a command like:</p>
<div class="highlight-python"><div class="highlight"><pre>make mpi
or
gmake serial
</pre></div>
</div>
<p>NOTE On a multi-processor or multi-core platform you can launch a
parallel make, by using the &#8220;-j <em>nprocessors</em>&#8221; switch with the make command, which
will build LIGGGHTS(R)-PUBLIC more quickly.</p>
<p>If you get no errors and an executable like lmp_mpi or lmp_serial is produced,
you&#8217;re done; it&#8217;s your lucky day.</p>
<p>Note that by default only a few of LIGGGHTS(R)-PUBLIC optional packages are
installed.  To build LIGGGHTS(R)-PUBLIC with optional packages, see <a class="reference internal" href="#start-3"><span>this section</span></a> below.</p>
<p><strong>Step 1</strong></p>
<p>If Step 0 did not work, you will need to create a low-level Makefile
for your machine, like Makefile.foo.  You should make a copy of an
existing src/MAKE/Makefile.* as a starting point.  The only portions
of the file you need to edit are the first line, the &#8220;compiler/linker
settings&#8221; section, and the &#8220;LIGGGHTS(R)-PUBLIC-specific settings&#8221; section.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Do not attempt to copy and modify Makefile.auto as this is a rather
complex file and should only be modified by experts.</p>
</div>
<p><strong>Step 2</strong></p>
<p>Change the first line of src/MAKE/Makefile.foo to list the word &#8220;foo&#8221;
after the &#8220;#&#8221;, and whatever other options it will set.  This is the
line you will see if you just type &#8220;make&#8221;.</p>
<p><strong>Step 3</strong></p>
<p>The &#8220;compiler/linker settings&#8221; section lists compiler and linker
settings for your C++ compiler, including optimization flags.  You can
use g++, the open-source GNU compiler, which is available on all Unix
systems.  You can also use mpicc which will typically be available if
MPI is installed on your system, though you should check which actual
compiler it wraps.  Vendor compilers often produce faster code.  On
boxes with Intel CPUs, we suggest using the commercial Intel icc
compiler, which can be downloaded from <a class="reference external" href="http://www.intel.com/software/products/noncom">Intel&#8217;s compiler site</a>.</p>
<p>If building a C++ code on your machine requires additional libraries,
then you should list them as part of the LIB variable.</p>
<p>The DEPFLAGS setting is what triggers the C++ compiler to create a
dependency list for a source file.  This speeds re-compilation when
source (<em>.cpp) or header (</em>.h) files are edited.  Some compilers do
not support dependency file creation, or may use a different switch
than -D.  GNU g++ works with -D.  If your compiler can&#8217;t create
dependency files, then you&#8217;ll need to create a Makefile.foo patterned
after Makefile.storm, which uses different rules that do not involve
dependency files.  Note that when you build LIGGGHTS(R)-PUBLIC for the first time
on a new platform, a long list of <a href="#id1"><span class="problematic" id="id2">*</span></a>.d files will be printed out
rapidly.  This is not an error; it is the Makefile doing its normal
creation of dependencies.</p>
<p><strong>Step 4</strong></p>
<p>The &#8220;system-specific settings&#8221; section has several parts.  Note that
if you change any -D setting in this section, you should do a full
re-compile, after typing &#8220;make clean&#8221; (which will describe different
clean options).</p>
<p>The LMP_INC variable is used to include options that turn on ifdefs
within the LIGGGHTS(R)-PUBLIC code.  The options that are currently recogized are:</p>
<ul class="simple">
<li>-DLAMMPS_GZIP</li>
<li>-DLAMMPS_JPEG</li>
<li>-DLAMMPS_PNG</li>
<li>-DLAMMPS_FFMPEG</li>
<li>-DLAMMPS_MEMALIGN</li>
<li>-DLAMMPS_XDR</li>
<li>-DLAMMPS_SMALLBIG</li>
<li>-DLAMMPS_BIGBIG</li>
<li>-DLAMMPS_SMALLSMALL</li>
<li>-DLAMMPS_LONGLONG_TO_LONG</li>
<li>-DPACK_ARRAY</li>
<li>-DPACK_POINTER</li>
<li>-DPACK_MEMCPY</li>
</ul>
<p>The read_data and dump commands will read/write gzipped files if you
compile with -DLAMMPS_GZIP.  It requires that your machine supports
the &#8220;popen&#8221; function in the standard runtime library and that a gzip
executable can be found by LIGGGHTS(R)-PUBLIC during a run.</p>
<p>If you use -DLAMMPS_JPEG, the <a class="reference internal" href="dump_image.html"><em>dump image</em></a> command
will be able to write out JPEG image files. For JPEG files, you must
also link LIGGGHTS(R)-PUBLIC with a JPEG library, as described below. If you use
-DLAMMPS_PNG, the <a class="reference internal" href="dump.html"><em>dump image</em></a> command will be able to write
out PNG image files.  For PNG files, you must also link LIGGGHTS(R)-PUBLIC with a
PNG library, as described below.  If neither of those two defines are
used, LIGGGHTS(R)-PUBLIC will only be able to write out uncompressed PPM image
files.</p>
<p>If you use -DLAMMPS_FFMPEG, the <a class="reference internal" href="dump_image.html"><em>dump movie</em></a> command
will be available to support on-the-fly generation of rendered movies
the need to store intermediate image files. It requires that your
machines supports the &#8220;popen&#8221; function in the standard runtime library
and that an FFmpeg executable can be found by LIGGGHTS(R)-PUBLIC during the run.</p>
<p>Using -DLAMMPS_MEMALIGN=&lt;bytes&gt; enables the use of the
posix_memalign() call instead of malloc() when large chunks or memory
are allocated by LIGGGHTS(R)-PUBLIC.  This can help to make more efficient use of
vector instructions of modern CPUS, since dynamically allocated memory
has to be aligned on larger than default byte boundaries (e.g. 16
bytes instead of 8 bytes on x86 type platforms) for optimal
performance.</p>
<p>If you use -DLAMMPS_XDR, the build will include XDR compatibility
files for doing particle dumps in XTC format.  This is only necessary
if your platform does have its own XDR files available.  See the
Restrictions section of the <a class="reference internal" href="dump.html"><em>dump</em></a> command for details.</p>
<p>Use at most one of the -DLAMMPS_SMALLBIG, -DLAMMPS_BIGBIG,
-D-DLAMMPS_SMALLSMALL settings.  The default is -DLAMMPS_SMALLBIG.
These settings refer to use of 4-byte (small) vs 8-byte (big) integers
within LIGGGHTS(R)-PUBLIC, as specified in src/lmptype.h.  The only reason to use
the BIGBIG setting is to enable simulation of huge molecular systems
with more than 2 billion atoms or to allow moving atoms to wrap back
through a periodic box more than 512 times.  The only reason to use
the SMALLSMALL setting is if your machine does not support 64-bit
integers.  See the <a class="reference internal" href="#start-2-4"><span>Additional build tips</span></a> section below
for more details.</p>
<p>The -DLAMMPS_LONGLONG_TO_LONG setting may be needed if your system or
MPI version does not recognize &#8220;long long&#8221; data types.  In this case a
&#8220;long&#8221; data type is likely already 64-bits, in which case this setting
will convert to that data type.</p>
<p>Using one of the -DPACK_ARRAY, -DPACK_POINTER, and -DPACK_MEMCPY
options can make for faster parallel FFTs (in the PPPM solver) on some
platforms.  The -DPACK_ARRAY setting is the default.  See the
<code class="xref doc docutils literal"><span class="pre">kspace_style</span></code> command for info about PPPM.  See
Step 6 below for info about building LIGGGHTS(R)-PUBLIC with an FFT library.</p>
<p><strong>Step 5</strong></p>
<p>The 3 MPI variables are used to specify an MPI library to build LAMMPS
with.</p>
<p>If you want LIGGGHTS(R)-PUBLIC to run in parallel, you must have an MPI library
installed on your platform.  If you use an MPI-wrapped compiler, such
as &#8220;mpicc&#8221; to build LIGGGHTS(R)-PUBLIC, you should be able to leave these 3
variables blank; the MPI wrapper knows where to find the needed files.
If not, and MPI is installed on your system in the usual place (under
/usr/local), you also may not need to specify these 3 variables.  On
some large parallel machines which use &#8220;modules&#8221; for their
compile/link environements, you may simply need to include the correct
module in your build environment.  Or the parallel machine may have a
vendor-provided MPI which the compiler has no trouble finding.</p>
<p>Failing this, with these 3 variables you can specify where the mpi.h
file (MPI_INC) and the MPI library file (MPI_PATH) are found and the
name of the library file (MPI_LIB).</p>
<p>If you are installing MPI yourself, we recommend Argonne&#8217;s MPICH2
or OpenMPI.  MPICH can be downloaded from the <a class="reference external" href="http://www.mcs.anl.gov/research/projects/mpich2/">Argonne MPI site</a>.  OpenMPI can
be downloaded from the <a class="reference external" href="http://www.open-mpi.org">OpenMPI site</a>.
Other MPI packages should also work. If you are running on a big
parallel platform, your system people or the vendor should have
already installed a version of MPI, which is likely to be faster
than a self-installed MPICH or OpenMPI, so find out how to build
and link with it.  If you use MPICH or OpenMPI, you will have to
configure and build it for your platform.  The MPI configure script
should have compiler options to enable you to use the same compiler
you are using for the LIGGGHTS(R)-PUBLIC build, which can avoid problems that can
arise when linking LIGGGHTS(R)-PUBLIC to the MPI library.</p>
<p>If you just want to run LIGGGHTS(R)-PUBLIC on a single processor, you can use the
dummy MPI library provided in src/STUBS, since you don&#8217;t need a true
MPI library installed on your system.  See the
src/MAKE/Makefile.serial file for how to specify the 3 MPI variables
in this case.  You will also need to build the STUBS library for your
platform before making LIGGGHTS(R)-PUBLIC itself.  To build from the src
directory, type &#8220;make stubs&#8221;, or from the STUBS dir, type &#8220;make&#8221;.
This should create a libmpi_stubs.a file suitable for linking to
LIGGGHTS(R)-PUBLIC.  If the build fails, you will need to edit the STUBS/Makefile
for your platform.</p>
<p>The file STUBS/mpi.c provides a CPU timer function called
MPI_Wtime() that calls gettimeofday() .  If your system doesn&#8217;t
support gettimeofday() , you&#8217;ll need to insert code to call another
timer.  Note that the ANSI-standard function clock() rolls over after
an hour or so, and is therefore insufficient for timing long LIGGGHTS(R)-PUBLIC
simulations.</p>
<p><strong>Step 6</strong></p>
<p>The 3 FFT variables allow you to specify an FFT library which LIGGGHTS(R)-PUBLIC
uses (for performing 1d FFTs) when running the particle-particle
particle-mesh (PPPM) option for long-range Coulombics via the
<code class="xref doc docutils literal"><span class="pre">kspace_style</span></code> command.</p>
<p>LIGGGHTS(R)-PUBLIC supports various open-source or vendor-supplied FFT libraries
for this purpose.  If you leave these 3 variables blank, LIGGGHTS(R)-PUBLIC will
use the open-source <a class="reference external" href="http://kissfft.sf.net">KISS FFT library</a>, which is
included in the LIGGGHTS(R)-PUBLIC distribution.  This library is portable to all
platforms and for typical LIGGGHTS(R)-PUBLIC simulations is almost as fast as FFTW
or vendor optimized libraries.  If you are not including the KSPACE
package in your build, you can also leave the 3 variables blank.</p>
<p>Otherwise, select which kinds of FFTs to use as part of the FFT_INC
setting by a switch of the form -DFFT_XXX.  Recommended values for XXX
are: MKL, SCSL, FFTW2, and FFTW3.  Legacy options are: INTEL, SGI,
ACML, and T3E.  For backward compatability, using -DFFT_FFTW will use
the FFTW2 library.  Using -DFFT_NONE will use the KISS library
described above.</p>
<p>You may also need to set the FFT_INC, FFT_PATH, and FFT_LIB variables,
so the compiler and linker can find the needed FFT header and library
files.  Note that on some large parallel machines which use &#8220;modules&#8221;
for their compile/link environements, you may simply need to include
the correct module in your build environment.  Or the parallel machine
may have a vendor-provided FFT library which the compiler has no
trouble finding.</p>
<p>FFTW is a fast, portable library that should also work on any
platform.  You can download it from
<a class="reference external" href="http://www.fftw.org">www.fftw.org</a>.  Both the legacy version 2.1.X and
the newer 3.X versions are supported as -DFFT_FFTW2 or -DFFT_FFTW3.
Building FFTW for your box should be as simple as ./configure; make.
Note that on some platforms FFTW2 has been pre-installed, and uses
renamed files indicating the precision it was compiled with,
e.g. sfftw.h, or dfftw.h instead of fftw.h.  In this case, you can
specify an additional define variable for FFT_INC called -DFFTW_SIZE,
which will select the correct include file.  In this case, for FFT_LIB
you must also manually specify the correct library, namely -lsfftw or
-ldfftw.</p>
<p>The FFT_INC variable also allows for a -DFFT_SINGLE setting that will
use single-precision FFTs with PPPM, which can speed-up long-range
calulations, particularly in parallel or on GPUs.  Fourier transform
and related PPPM operations are somewhat insensitive to floating point
truncation errors and thus do not always need to be performed in
double precision.  Using the -DFFT_SINGLE setting trades off a little
accuracy for reduced memory use and parallel communication costs for
transposing 3d FFT data.  Note that single precision FFTs have only
been tested with the FFTW3, FFTW2, MKL, and KISS FFT options.</p>
<p><strong>Step 7</strong></p>
<p>The 3 JPG variables allow you to specify a JPEG and/or PNG library
which LIGGGHTS(R)-PUBLIC uses when writing out JPEG or PNG files via the <a class="reference internal" href="dump_image.html"><em>dump image</em></a> command.  These can be left blank if you do not
use the -DLAMMPS_JPEG or -DLAMMPS_PNG switches discussed above in Step
4, since in that case JPEG/PNG output will be disabled.</p>
<p>A standard JPEG library usually goes by the name libjpeg.a or
libjpeg.so and has an associated header file jpeglib.h.  Whichever
JPEG library you have on your platform, you&#8217;ll need to set the
appropriate JPG_INC, JPG_PATH, and JPG_LIB variables, so that the
compiler and linker can find it.</p>
<p>A standard PNG library usually goes by the name libpng.a or libpng.so
and has an associated header file png.h.  Whichever PNG library you
have on your platform, you&#8217;ll need to set the appropriate JPG_INC,
JPG_PATH, and JPG_LIB variables, so that the compiler and linker can
find it.</p>
<p>As before, if these header and library files are in the usual place on
your machine, you may not need to set these variables.</p>
<p><strong>Step 8</strong></p>
<p>Note that by default only a few of LIGGGHTS(R)-PUBLIC optional packages are
installed.  To build LIGGGHTS(R)-PUBLIC with optional packages, see <a class="reference internal" href="#start-3"><span>this section</span></a> below, before proceeding to Step 9.</p>
<p><strong>Step 9</strong></p>
<p>That&#8217;s it.  Once you have a correct Makefile.foo, you have installed
the optional LIGGGHTS(R)-PUBLIC packages you want to include in your build, and
you have pre-built any other needed libraries (e.g. MPI, FFT, package
libraries), all you need to do from the src directory is type
something like this:</p>
<div class="highlight-python"><div class="highlight"><pre>make foo
or
gmake foo
</pre></div>
</div>
<p>You should get the executable lmp_foo when the build is complete.</p>
<hr class="docutils" />
</div>
<div class="section" id="errors-that-can-occur-when-making-liggghts-r-public">
<span id="start-2-3"></span><h3>2.2.4. <strong>Errors that can occur when making LIGGGHTS(R)-PUBLIC:</strong><a class="headerlink" href="#errors-that-can-occur-when-making-liggghts-r-public" title="Permalink to this headline">¶</a></h3>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">If an error occurs when building LIGGGHTS(R)-PUBLIC, the compiler
or linker will state very explicitly what the problem is.  The error
message should give you a hint as to which of the steps above has
failed, and what you need to do in order to fix it.  Building a code
with a Makefile is a very logical process.  The compiler and linker
need to find the appropriate files and those files need to be
compatible with LIGGGHTS(R)-PUBLIC source files.  When a make fails, there is
usually a very simple reason, which you or a local expert will need to
fix.</p>
</div>
<p>Here are two non-obvious errors that can occur:</p>
<p>(1) If the make command breaks immediately with errors that indicate
it can&#8217;t find files with a &#8220;*&#8221; in their names, this can be because
your machine&#8217;s native make doesn&#8217;t support wildcard expansion in a
makefile.  Try gmake instead of make.  If that doesn&#8217;t work, try using
a -f switch with your make command to use a pre-generated
Makefile.list which explicitly lists all the needed files, e.g.</p>
<div class="highlight-python"><div class="highlight"><pre>make makelist
make -f Makefile.list linux
gmake -f Makefile.list mac
</pre></div>
</div>
<p>The first &#8220;make&#8221; command will create a current Makefile.list with all
the file names in your src dir.  The 2nd &#8220;make&#8221; command (make or
gmake) will use it to build LIGGGHTS(R)-PUBLIC.  Note that you should
include/exclude any desired optional packages before using the &#8220;make
makelist&#8221; command.</p>
<p>(2) If you get an error that says something like &#8216;identifier &#8220;atoll&#8221;
is undefined&#8217;, then your machine does not support &#8220;long long&#8221;
integers.  Try using the -DLAMMPS_LONGLONG_TO_LONG setting described
above in Step 4.</p>
<hr class="docutils" />
</div>
<div class="section" id="additional-build-tips">
<span id="start-2-4"></span><h3>2.2.5. <strong>Additional build tips:</strong><a class="headerlink" href="#additional-build-tips" title="Permalink to this headline">¶</a></h3>
<ol class="arabic simple">
<li>Building LIGGGHTS(R)-PUBLIC for multiple platforms.</li>
</ol>
<p>You can make LIGGGHTS(R)-PUBLIC for multiple platforms from the same src
directory.  Each target creates its own object sub-directory called
Obj_target where it stores the system-specific <a href="#id3"><span class="problematic" id="id4">*</span></a>.o files.</p>
<ol class="arabic simple" start="2">
<li>Cleaning up.</li>
</ol>
<p>Typing &#8220;make clean-all&#8221; or &#8220;make clean-machine&#8221; will delete <a href="#id5"><span class="problematic" id="id6">*</span></a>.o object
files created when LIGGGHTS(R)-PUBLIC is built, for either all builds or for a
particular machine.</p>
<p>(3) Changing the LIGGGHTS(R)-PUBLIC size limits via -DLAMMPS_SMALLBIG or
-DLAMMPS_BIBIG or -DLAMMPS_SMALLSMALL</p>
<p>As explained above, any of these 3 settings can be specified on the
LMP_INC line in your low-level src/MAKE/Makefile.foo.</p>
<p>The default is -DLAMMPS_SMALLBIG which allows for systems with up to
2^63 atoms and timesteps (about 9 billion billion).  The atom limit is
for atomic systems that do not require atom IDs.  For molecular
models, which require atom IDs, the limit is 2^31 atoms (about 2
billion).  With this setting, image flags are stored in 32-bit
integers, which means for 3 dimensions that atoms can only wrap around
a periodic box at most 512 times.  If atoms move through the periodic
box more than this limit, the image flags will &#8220;roll over&#8221;, e.g. from
511 to -512, which can cause diagnostics like the mean-squared
displacement, as calculated by the <a class="reference internal" href="compute_msd.html"><em>compute msd</em></a>
command, to be faulty.</p>
<p>To allow for larger molecular systems or larger image flags, compile
with -DLAMMPS_BIGBIG.  This enables molecular systems with up to 2^63
atoms (about 9 billion billion).  And image flags will not &#8220;roll over&#8221;
until they reach 2^20 = 1048576.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">As of 6/2012, the BIGBIG setting does not yet enable
molecular systems to grow as large as 2^63.  Only the image flag roll
over is currently affected by this compile option.</p>
</div>
<p>If your system does not support 8-byte integers, you will need to
compile with the -DLAMMPS_SMALLSMALL setting.  This will restrict your
total number of atoms (for atomic or molecular models) and timesteps
to 2^31 (about 2 billion).  Image flags will roll over at 2^9 = 512.</p>
<p>Note that in src/lmptype.h there are also settings for the MPI data
types associated with the integers that store atom IDs and total
system sizes.  These need to be consistent with the associated C data
types, or else LIGGGHTS(R)-PUBLIC will generate a run-time error.</p>
<p>In all cases, the size of problem that can be run on a per-processor
basis is limited by 4-byte integer storage to 2^31 atoms per processor
(about 2 billion).  This should not normally be a restriction since
such a problem would have a huge per-processor memory footprint due to
neighbor lists and would run very slowly in terms of CPU
secs/timestep.</p>
<hr class="docutils" />
</div>
<div class="section" id="building-for-a-mac">
<span id="start-2-5"></span><h3>2.2.6. <strong>Building for a Mac:</strong><a class="headerlink" href="#building-for-a-mac" title="Permalink to this headline">¶</a></h3>
<p>OS X is BSD Unix, so it should just work. Try using &#8220;make auto&#8221; or use &#8220;make
serial&#8221; as fallback. This is untested but feel free to give us feedback on
<a class="reference external" href="www.cfdem.com">cfdem.com</a></p>
<hr class="docutils" />
</div>
<div class="section" id="building-for-windows">
<span id="start-2-6"></span><h3>2.2.7. <strong>Building for Windows:</strong><a class="headerlink" href="#building-for-windows" title="Permalink to this headline">¶</a></h3>
<p>The recommened way to do this is using CMake and Visual Studio. Install
<a class="reference external" href="www.cmake.org">CMake</a> and launch the associated GUI. Point the <em>Where is your
source code:</em> input to your <em>src/</em> folder and set the <em>build</em> folder to some
folder (recommended: make a <em>build</em> folder in your LIGGGHTS(R)-PUBLIC-base directory).
Press <em>Configure</em> to get your system settings. You will most likely have to set
the <em>VTK_DIR</em> option to the folder in which you built the VTK library. Once this
is done press <em>Configure</em> again until all errors are reolved so that you can
<em>Generate</em> the project. After that you should be able to press <em>Open Project</em> to
open Visual Studio where you can build LIGGGHTS(R)-PUBLIC.</p>
<p>The other way to do this is install and use <a class="reference external" href="www.cygwin.org">cygwin</a> to build
LIGGGHTS(R)-PUBLIC with a standard Linux make, just as you would on any Linux box. Your
cygwin environment will need several packages such as cmake, g++, gcc, openmpi,
make. Note that when compiling VTK you need to disable all rendering related VTK
options as OpenGL won&#8217;t be available. Note that this is an option that should
only be used by advanced users.</p>
<hr class="docutils" />
</div>
</div>
<div class="section" id="making-liggghts-r-public-with-optional-packages">
<span id="start-3"></span><h2><a class="toc-backref" href="#id13">2.3. Making LIGGGHTS(R)-PUBLIC with optional packages</a><a class="headerlink" href="#making-liggghts-r-public-with-optional-packages" title="Permalink to this headline">¶</a></h2>
<p>This section has the following sub-sections:</p>
<ul class="simple">
<li><a class="reference internal" href="#start-3-1"><span>Package basics</span></a></li>
<li><a class="reference internal" href="#start-3-2"><span>Including/excluding packages</span></a></li>
<li><a class="reference internal" href="#start-3-3"><span>Packages that require extra libraries</span></a></li>
<li><span class="xref std std-ref">Additional Makefile settings for extra libraries</span></li>
</ul>
<hr class="docutils" />
<p id="start-3-1"><strong>Package basics:</strong></p>
<p>The source code for LIGGGHTS(R)-PUBLIC is structured as a set of core files which
are always included, plus optional packages.  Packages are groups of
files that enable a specific set of features.  For example, force
fields for molecular systems or granular systems are in packages.  You
can see the list of all packages by typing &#8220;make package&#8221; from within
the src directory of the LIGGGHTS(R)-PUBLIC distribution.</p>
<p>If you use a command in a LIGGGHTS(R)-PUBLIC input script that is specific to a
particular package, you must have built LIGGGHTS(R)-PUBLIC with that package, else
you will get an error that the style is invalid or the command is
unknown.  Every command&#8217;s doc page specfies if it is part of a
package.  You can also type</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">lmp_machine</span> <span class="o">-</span><span class="n">h</span>
</pre></div>
</div>
<p>to run your executable with the optional <a class="reference internal" href="#start-7"><span>-h command-line switch</span></a> for &#8220;help&#8221;, which will list the styles and commands
known to your executable.</p>
<p>There are two kinds of packages in LIGGGHTS(R)-PUBLIC, standard and user packages.
More information about the contents of standard and user packages is
given in <a class="reference internal" href="Section_packages.html"><em>Section_packages</em></a> of the manual.  The
difference between standard and user packages is as follows:</p>
<p>Standard packages are supported by the LIGGGHTS(R)-PUBLIC developers and are
written in a syntax and style consistent with the rest of LIGGGHTS(R)-PUBLIC.
This means we will answer questions about them, debug and fix them if
necessary, and keep them compatible with future changes to LIGGGHTS(R)-PUBLIC.</p>
<p>User packages have been contributed by users, and always begin with
the user prefix.  If they are a single command (single file), they are
typically in the user-misc package.  Otherwise, they are a a set of
files grouped together which add a specific functionality to the code.</p>
<p>Some packages (both standard and user) require additional libraries.
See more details below.</p>
<hr class="docutils" />
<p id="start-3-2"><strong>Including/excluding packages:</strong></p>
<p>To use or not use a package you must include or exclude it before
building LIGGGHTS(R)-PUBLIC.  From the src directory, this is typically as simple
as:</p>
<pre class="literal-block">
make yes-<strong>package-name</strong>
make g++
</pre>
<p>or</p>
<pre class="literal-block">
make no-<strong>package-name</strong>
make g++
</pre>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">You should NOT include/exclude packages and build
LIGGGHTS(R)-PUBLIC in a single make command by using multiple targets, e.g. make
yes-colloid g++.  This is because the make procedure creates a list of
source files that will be out-of-date for the build if the package
configuration changes during the same command.</p>
</div>
<p>Some packages have individual files that depend on other packages
being included.  LIGGGHTS(R)-PUBLIC checks for this and does the right thing.
I.e. individual files are only included if their dependencies are
already included.  Likewise, if a package is excluded, other files
dependent on that package are also excluded.</p>
<p>The reason to exclude packages is if you will never run certain kinds
of simulations.  For some packages, this will keep you from having to
build auxiliary libraries (see below), and will also produce a smaller
executable which may run a bit faster.</p>
<p>When you download a LIGGGHTS(R)-PUBLIC tarball, these packages are pre-installed
in the src directory: KSPACE, MANYBODY,MOLECULE.  When you download
LIGGGHTS(R)-PUBLIC source files from the SVN or Git repositories, no packages are
pre-installed.</p>
<p>Packages are included or excluded by typing &#8220;make yes-name&#8221; or &#8220;make
no-name&#8221;, where &#8220;name&#8221; is the name of the package in lower-case.
You can also type &#8220;make yes-all&#8221;
or &#8220;make no-all&#8221; to include/exclude various sets of packages.  Type &#8220;make
package&#8221; to see the all of the package-related make options.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Inclusion/exclusion of a package works by simply
moving files back and forth between the main src directory and
sub-directories with the package name.  After
you have included or excluded a package, you must re-build LIGGGHTS(R)-PUBLIC.</p>
</div>
<p>Additional package-related make options exist to help manage LIGGGHTS(R)-PUBLIC
files that exist in both the src directory and in package
sub-directories.  You do not normally need to use these commands
unless you are editing LIGGGHTS(R)-PUBLIC files or have downloaded a patch from
the LIGGGHTS(R)-PUBLIC WWW site.</p>
<p>Typing &#8220;make package-update&#8221; will overwrite src files with files from
the package sub-directories if the package has been included.  It
should be used after a patch is installed, since patches only update
the files in the package sub-directory, but not the src files.  Typing
&#8220;make package-overwrite&#8221; will overwrite files in the package
sub-directories with src files.</p>
<p>Typing &#8220;make package-status&#8221; will show which packages are currently
included. Of those that are included, it will list files that are
different in the src directory and package sub-directory.  Typing
&#8220;make package-diff&#8221; lists all differences between these files.  Again,
type &#8220;make package&#8221; to see all of the package-related make options.</p>
<hr class="docutils" />
<p id="start-3-3"><strong>Packages that require extra libraries:</strong></p>
<p>A few of the standard and user packages require additional auxiliary
libraries.  They must be compiled first, before LIGGGHTS(R)-PUBLIC is built.  If
you get a LIGGGHTS(R)-PUBLIC build error about a missing library, this is likely
the reason.  See the <a class="reference internal" href="Section_packages.html"><em>Section_packages</em></a> doc page
for a list of packages that have auxiliary libraries.</p>
<p>Code for some of these auxiliary libraries is included in the LIGGGHTS(R)-PUBLIC
distribution under the lib directory.  Some auxiliary libraries are not
included with LIGGGHTS(R)-PUBLIC;
to use the associated package you must download and install the
auxiliary library yourself.  Example is the VORONOI packages.</p>
<p>For libraries with provided source code, each lib directory has a
README file (e.g. lib/reax/README) with instructions on how to build
that library.  Typically this is done by typing something like:</p>
<div class="highlight-python"><div class="highlight"><pre>make -f Makefile.g++
</pre></div>
</div>
<p>If one of the provided Makefiles is not
appropriate for your system you will need to edit or add one.
Note that all the Makefiles have a setting for EXTRAMAKE at
the top that names a Makefile.lammps.* file.</p>
<p>If successful, this will produce 2 files in the lib directory:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">libpackage</span><span class="o">.</span><span class="n">a</span>
<span class="n">Makefile</span><span class="o">.</span><span class="n">lammps</span>
</pre></div>
</div>
<p>The Makefile.lammps file is a copy of the EXTRAMAKE file specified
in the Makefile you used.</p>
<p>You MUST insure that the settings in Makefile.lammps are appropriate
for your system.  If they are not, the LIGGGHTS(R)-PUBLIC build will fail.</p>
<p>As explained in the lib/package/README files, they are used to specify
additional system libraries and their locations so that LIGGGHTS(R)-PUBLIC can
build with the auxiliary library.  For example, if the MEAM or REAX
packages are used, the auxiliary libraries consist of F90 code, build
with a F90 complier.  To link that library with LIGGGHTS(R)-PUBLIC (a C++ code)
via whatever C++ compiler LIGGGHTS(R)-PUBLIC is built with, typically requires
additional Fortran-to-C libraries be included in the link.  Another
example are the BLAS and LAPACK libraries needed to use the USER-ATC
or USER-AWPMD packages.</p>
<p>For libraries without provided source code, see the
src/package/Makefile.lammps file for information on where to find the
library and how to build it.  E.g. the file src/KIM/Makefile.lammps.
This file serves the same purpose as the lib/package/Makefile.lammps
file described above.  It has settings needed when LIGGGHTS(R)-PUBLIC is built to
link with the auxiliary library.  Again, you MUST insure that the
settings in src/package/Makefile.lammps are appropriate for your
system and where you installed the auxiliary library.  If they are
not, the LIGGGHTS(R)-PUBLIC build will fail.</p>
<hr class="docutils" />
</div>
<div class="section" id="building-liggghts-r-public-via-the-make-py-script">
<span id="start-4"></span><h2><a class="toc-backref" href="#id14">2.4. Building LIGGGHTS(R)-PUBLIC via the Make.py script</a><a class="headerlink" href="#building-liggghts-r-public-via-the-make-py-script" title="Permalink to this headline">¶</a></h2>
<p>The src directory includes a Make.py script, written
in Python, which can be used to automate various steps
of the build process.</p>
<p>You can run the script from the src directory by typing either:</p>
<div class="highlight-python"><div class="highlight"><pre>Make.py
python Make.py
</pre></div>
</div>
<p>which will give you info about the tool.  For the former to work, you
may need to edit the 1st line of the script to point to your local
Python.  And you may need to insure the script is executable:</p>
<div class="highlight-python"><div class="highlight"><pre>chmod +x Make.py
</pre></div>
</div>
<p>The following options are supported as switches:</p>
<ul class="simple">
<li>-i file1 file2 ...</li>
<li>-p package1 package2 ...</li>
<li>-u package1 package2 ...</li>
<li>-e package1 arg1 arg2 package2 ...</li>
<li>-o dir</li>
<li>-b machine</li>
<li>-s suffix1 suffix2 ...</li>
<li>-l dir</li>
<li>-j N</li>
<li>-h switch1 switch2 ...</li>
</ul>
<p>Help on any switch can be listed by using -h, e.g.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">Make</span><span class="o">.</span><span class="n">py</span> <span class="o">-</span><span class="n">h</span> <span class="o">-</span><span class="n">i</span> <span class="o">-</span><span class="n">p</span>
</pre></div>
</div>
<p>At a hi-level, these are the kinds of package management
and build tasks that can be performed easily, using
the Make.py tool:</p>
<ul class="simple">
<li>install/uninstall packages and build the associated external libs (use -p and -u and -e)</li>
<li>install packages needed for one or more input scripts (use -i and -p)</li>
<li>build LIGGGHTS(R)-PUBLIC, either in the src dir or new dir (use -b)</li>
<li>create a new dir with only the source code needed for one or more input scripts (use -i and -o)</li>
</ul>
<p>The last bullet can be useful when you wish to build a stripped-down
version of LIGGGHTS(R)-PUBLIC to run a specific script(s).  Or when you wish to
move the minimal amount of files to another platform for a remote
LIGGGHTS(R)-PUBLIC build.</p>
<p>Note that using Make.py is not a substitute for insuring you have a
valid src/MAKE/Makefile.foo for your system, or that external library
Makefiles in any lib/* directories you use are also valid for your
system.  But once you have done that, you can use Make.py to quickly
include/exclude the packages and external libraries needed by your
input scripts.</p>
<hr class="docutils" />
</div>
<div class="section" id="building-liggghts-r-public-as-a-library">
<span id="start-5"></span><h2><a class="toc-backref" href="#id15">2.5. Building LIGGGHTS(R)-PUBLIC as a library</a><a class="headerlink" href="#building-liggghts-r-public-as-a-library" title="Permalink to this headline">¶</a></h2>
<p>LIGGGHTS(R)-PUBLIC can be built as either a static or shared library, which can
then be called from another application or a scripting language.  See
<a class="reference internal" href="Section_howto.html#howto-10"><span>this section</span></a> for more info on coupling
LIGGGHTS(R)-PUBLIC to other codes.  See <a class="reference internal" href="Section_python.html"><em>this section</em></a> for
more info on wrapping and running LIGGGHTS(R)-PUBLIC from Python.</p>
<div class="section" id="static-library">
<h3>2.5.1. <strong>Static library:</strong><a class="headerlink" href="#static-library" title="Permalink to this headline">¶</a></h3>
<p>To build LIGGGHTS(R)-PUBLIC as a static library (<a href="#id7"><span class="problematic" id="id8">*</span></a>.a file on Linux), type</p>
<div class="highlight-python"><div class="highlight"><pre>make makelib
make -f Makefile.lib foo
</pre></div>
</div>
<p>where foo is the machine name (if you normally compile with <em>auto</em> then use
this option).  This kind of library is typically used to statically link a
driver application to LIGGGHTS(R)-PUBLIC, so that you can insure all dependencies
are satisfied at compile time.  Note that inclusion or exclusion of any
desired optional packages should be done before typing &#8220;make makelib&#8221;.  The
first &#8220;make&#8221; command will create a current Makefile.lib with all the file
names in your src dir.  The second &#8220;make&#8221; command will use it to build
LIGGGHTS(R)-PUBLIC as a static library, using the ARCHIVE and ARFLAGS settings in
src/MAKE/Makefile.foo.  The build will create the file liblammps_foo.a which
another application can link to.</p>
</div>
<div class="section" id="shared-library">
<h3>2.5.2. <strong>Shared library:</strong><a class="headerlink" href="#shared-library" title="Permalink to this headline">¶</a></h3>
<p>To build LIGGGHTS(R)-PUBLIC as a shared library (<a href="#id9"><span class="problematic" id="id10">*</span></a>.so file on Linux), which can be
dynamically loaded, e.g. from Python, type</p>
<div class="highlight-python"><div class="highlight"><pre>make makeshlib
make -f Makefile.shlib foo
</pre></div>
</div>
<p>where foo is the machine name (if you normally compile with <em>auto</em> then use
this option). This kind of library is required when wrapping LIGGGHTS(R)-PUBLIC
with Python; see <a class="reference internal" href="Section_python.html"><em>Section_python</em></a> for details.  Again,
note that inclusion or exclusion of any desired optional packages should be
done before typing &#8220;make makelib&#8221;.  The first &#8220;make&#8221; command will create a
current Makefile.shlib with all the file names in your src dir.  The second
&#8220;make&#8221; command will use it to build LIGGGHTS(R)-PUBLIC as a shared library, using
the SHFLAGS and SHLIBFLAGS settings in src/MAKE/Makefile.foo.  The build
will create the file liblammps_foo.so which another application can link to
dyamically.  It will also create a soft link liblammps.so, which the Python
wrapper uses by default.</p>
<p>Note that for a shared library to be usable by a calling program, all
the auxiliary libraries it depends on must also exist as shared
libraries.  This will be the case for libraries included with LIGGGHTS(R)-PUBLIC,
such as the dummy MPI library in src/STUBS or any package libraries in
lib/packges, since they are always built as shared libraries with the
-fPIC switch.  However, if a library like MPI or FFTW does not exist
as a shared library, the second make command will generate an error.
This means you will need to install a shared library version of the
package.  The build instructions for the library should tell you how
to do this.</p>
<p>As an example, here is how to build and install the <a class="reference external" href="http://www-unix.mcs.anl.gov/mpi">MPICH library</a>, a popular open-source version of MPI, distributed by
Argonne National Labs, as a shared library in the default
/usr/local/lib location:</p>
<div class="highlight-python"><div class="highlight"><pre>./configure --enable-shared
make
make install
</pre></div>
</div>
<p>You may need to use &#8220;sudo make install&#8221; in place of the last line if
you do not have write privileges for /usr/local/lib.  The end result
should be the file /usr/local/lib/libmpich.so.</p>
</div>
<div class="section" id="additional-requirement-for-using-a-shared-library">
<h3>2.5.3. <strong>Additional requirement for using a shared library:</strong><a class="headerlink" href="#additional-requirement-for-using-a-shared-library" title="Permalink to this headline">¶</a></h3>
<p>The operating system finds shared libraries to load at run-time using
the environment variable LD_LIBRARY_PATH.  So you may wish to copy the
file src/liblammps.so or src/liblammps_g++.so (for example) to a place
the system can find it by default, such as /usr/local/lib, or you may
wish to add the LIGGGHTS(R)-PUBLIC src directory to LD_LIBRARY_PATH, so that the
current version of the shared library is always available to programs
that use it.</p>
<p>For the csh or tcsh shells, you would add something like this to your
~/.cshrc file:</p>
<div class="highlight-python"><div class="highlight"><pre>setenv LD_LIBRARY_PATH $*LD_LIBRARY_PATH*:/home/sjplimp/lammps/src
</pre></div>
</div>
</div>
<div class="section" id="calling-the-liggghts-r-public-library">
<h3>2.5.4. <strong>Calling the LIGGGHTS(R)-PUBLIC library:</strong><a class="headerlink" href="#calling-the-liggghts-r-public-library" title="Permalink to this headline">¶</a></h3>
<p>Either flavor of library (static or shared0 allows one or more LIGGGHTS(R)-PUBLIC
objects to be instantiated from the calling program.</p>
<p>When used from a C++ program, all of LIGGGHTS(R)-PUBLIC is wrapped in a LAMMPS_NS
namespace; you can safely use any of its classes and methods from
within the calling code, as needed.</p>
<p>When used from a C or Fortran program or a scripting language like
Python, the library has a simple function-style interface, provided in
src/library.cpp and src/library.h.</p>
<p>See the sample codes in examples/COUPLE/simple for examples of C++ and
C and Fortran codes that invoke LIGGGHTS(R)-PUBLIC thru its library interface.
There are other examples as well in the COUPLE directory which are
discussed in <a class="reference internal" href="Section_howto.html#howto-10"><span>Section_howto 10</span></a> of the
manual.  See <a class="reference internal" href="Section_python.html"><em>Section_python</em></a> of the manual for a
description of the Python wrapper provided with LIGGGHTS(R)-PUBLIC that operates
through the LIGGGHTS(R)-PUBLIC library interface.</p>
<p>The files src/library.cpp and library.h define the C-style API for
using LIGGGHTS(R)-PUBLIC as a library.  See <span class="xref std std-ref">Section_howto 19</span> of the manual for a description of the
interface and how to extend it for your needs.</p>
<hr class="docutils" />
</div>
</div>
<div class="section" id="running-liggghts-r-public">
<span id="start-6"></span><h2><a class="toc-backref" href="#id16">2.6. Running LIGGGHTS(R)-PUBLIC</a><a class="headerlink" href="#running-liggghts-r-public" title="Permalink to this headline">¶</a></h2>
<p>By default, LIGGGHTS(R)-PUBLIC runs by reading commands from stdin; e.g. lmp_auto
&lt; in.file.  This means you first create an input script (e.g. in.file)
containing the desired commands.  <a class="reference internal" href="Section_commands.html"><em>This section</em></a>
describes how input scripts are structured and what commands they
contain.</p>
<p>You can test LIGGGHTS(R)-PUBLIC on any of the sample inputs provided in the
examples or bench directory.  Input scripts are named in.* and sample
outputs are named log.*.name.P where name is a machine and P is the
number of processors it was run on.</p>
<p>Here is how you might run a standard chute wear benchmark on a
Linux box, using mpirun to launch a parallel job:</p>
<div class="highlight-python"><div class="highlight"><pre>cd src
make auto
cp lmp_auto ../examples/LIGGGHTS/Tutorials_public/chute_wear
cd ../examples/LIGGGHTS/Tutorials_public/chute_wear
mpirun -np 4 lmp_auto &lt; in.chute_wear
</pre></div>
</div>
<hr class="docutils" />
<p>On a Windows box, you can skip making LIGGGHTS(R)-PUBLIC and simply download an
executable, as described above, though the pre-packaged executables
include only certain packages.</p>
<p>To run a LIGGGHTS(R)-PUBLIC executable on a Windows machine, first decide whether
you want to download the non-MPI (serial) or the MPI (parallel)
version of the executable. Download and save the version you have
chosen.</p>
<p>For the non-MPI version, follow these steps:</p>
<ul class="simple">
<li>Get a command prompt by going to Start-&gt;Run... ,
then typing &#8220;cmd&#8221;.</li>
<li>Move to the directory where you have saved lmp_win_no-mpi.exe
(e.g. by typing: cd &#8220;Documents&#8221;).</li>
<li>At the command prompt, type &#8220;lmp_win_no-mpi -in in.lj&#8221;, replacing in.lj
with the name of your LIGGGHTS(R)-PUBLIC input script.</li>
</ul>
<p>For the MPI version, which allows you to run LIGGGHTS(R)-PUBLIC under Windows on
multiple processors, follow these steps:</p>
<ul class="simple">
<li>Download and install
<a class="reference external" href="http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads">MPICH2</a>
for Windows.</li>
<li>You&#8217;ll need to use the mpiexec.exe and smpd.exe files from the MPICH2 package. Put them in
same directory (or path) as the LIGGGHTS(R)-PUBLIC Windows executable.</li>
<li>Get a command prompt by going to Start-&gt;Run... ,
then typing &#8220;cmd&#8221;.</li>
<li>Move to the directory where you have saved lmp_win_mpi.exe
(e.g. by typing: cd &#8220;Documents&#8221;).</li>
<li>Then type something like this: &#8220;mpiexec -np 4 -localonly lmp_win_mpi -in in.lj&#8221;,
replacing in.lj with the name of your LIGGGHTS(R)-PUBLIC input script.</li>
<li>Note that you may need to provide smpd with a passphrase &#8212; it doesn&#8217;t matter what you
type.</li>
<li>In this mode, output may not immediately show up on the screen, so
if your input script takes a long time to execute, you may need to be
patient before the output shows up.</li>
<li>Alternatively, you can still use this executable to run on a single processor by
typing something like: &#8220;lmp_win_mpi -in in.lj&#8221;.</li>
</ul>
<hr class="docutils" />
<p>The screen output from LIGGGHTS(R)-PUBLIC is described in the next section.  As it
runs, LIGGGHTS(R)-PUBLIC also writes a log.lammps file with the same information.</p>
<p>Note that this sequence of commands copies the LIGGGHTS(R)-PUBLIC executable
(lmp_linux) to the directory with the input files.  This may not be
necessary, but some versions of MPI reset the working directory to
where the executable is, rather than leave it as the directory where
you launch mpirun from (if you launch lmp_linux on its own and not
under mpirun).  If that happens, LIGGGHTS(R)-PUBLIC will look for additional input
files and write its output files to the executable directory, rather
than your working directory, which is probably not what you want.</p>
<p>If LIGGGHTS(R)-PUBLIC encounters errors in the input script or while running a
simulation it will print an ERROR message and stop or a WARNING
message and continue.  See <a class="reference internal" href="Section_errors.html"><em>Section_errors</em></a> for a
discussion of the various kinds of errors LIGGGHTS(R)-PUBLIC can or can&#8217;t detect,
a list of all ERROR and WARNING messages, and what to do about them.</p>
<p>LIGGGHTS(R)-PUBLIC can run a problem on any number of processors, including a
single processor.  In theory you should get identical answers on any
number of processors and on any machine.  In practice, numerical
round-off can cause slight differences and eventual divergence of
molecular dynamics phase space trajectories.</p>
<p>LIGGGHTS(R)-PUBLIC can run as large a problem as will fit in the physical memory
of one or more processors.  If you run out of memory, you must run on
more processors or setup a smaller problem.</p>
<hr class="docutils" />
</div>
<div class="section" id="command-line-options">
<span id="start-7"></span><h2><a class="toc-backref" href="#id17">2.7. Command-line options</a><a class="headerlink" href="#command-line-options" title="Permalink to this headline">¶</a></h2>
<p>At run time, LIGGGHTS(R)-PUBLIC recognizes several optional command-line switches
which may be used in any order.  Either the full word or a one-or-two
letter abbreviation can be used:</p>
<ul class="simple">
<li>-e or -echo</li>
<li>-i or -in</li>
<li>-h or -help</li>
<li>-l or -log</li>
<li>-nc or -nocite</li>
<li>-p or -partition</li>
<li>-pl or -plog</li>
<li>-ps or -pscreen</li>
<li>-r or -restart</li>
<li>-ro or -reorder</li>
<li>-sc or -screen</li>
<li>-sf or -suffix</li>
<li>-v or -var</li>
</ul>
<p>For example, lmp_auto might be launched as follows:</p>
<div class="highlight-python"><div class="highlight"><pre>mpirun -np 16 lmp_auto -v f tmp.out -l my.log -sc none &lt; in.alloy
mpirun -np 16 lmp_auto -var f tmp.out -log my.log -screen none &lt; in.alloy
</pre></div>
</div>
<p>Here are the details on the options:</p>
<div class="highlight-python"><div class="highlight"><pre>-echo style
</pre></div>
</div>
<p>Set the style of command echoing.  The style can be <em>none</em> or <em>screen</em>
or <em>log</em> or <em>both</em>.  Depending on the style, each command read from
the input script will be echoed to the screen and/or logfile.  This
can be useful to figure out which line of your script is causing an
input error.  The default value is <em>log</em>.  The echo style can also be
set by using the <a class="reference internal" href="echo.html"><em>echo</em></a> command in the input script itself.</p>
<div class="highlight-python"><div class="highlight"><pre>-in file
</pre></div>
</div>
<p>Specify a file to use as an input script.  This is an optional switch
when running LIGGGHTS(R)-PUBLIC in one-partition mode.  If it is not specified,
LIGGGHTS(R)-PUBLIC reads its input script from stdin - e.g. lmp_auto &lt; in.run.
This is a required switch when running LIGGGHTS(R)-PUBLIC in multi-partition mode,
since multiple processors cannot all read from stdin.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="o">-</span><span class="n">help</span>
</pre></div>
</div>
<p>Print a list of options compiled into this executable for each LIGGGHTS(R)-PUBLIC
style (atom_style, fix, compute, pair_style, bond_style, etc).  This
can help you know if the command you want to use was included via the
appropriate package.  LIGGGHTS(R)-PUBLIC will print the info and immediately exit
if this switch is used.</p>
<div class="highlight-python"><div class="highlight"><pre>-log file
</pre></div>
</div>
<p>Specify a log file for LIGGGHTS(R)-PUBLIC to write status information to.  In
one-partition mode, if the switch is not used, LIGGGHTS(R)-PUBLIC writes to the
file log.lammps.  If this switch is used, LIGGGHTS(R)-PUBLIC writes to the
specified file.  In multi-partition mode, if the switch is not used, a
log.lammps file is created with hi-level status information.  Each
partition also writes to a log.lammps.N file where N is the partition
ID.  If the switch is specified in multi-partition mode, the hi-level
logfile is named &#8220;file&#8221; and each partition also logs information to a
file.N.  For both one-partition and multi-partition mode, if the
specified file is &#8220;none&#8221;, then no log files are created.  Using a
<a class="reference internal" href="log.html"><em>log</em></a> command in the input script will override this setting.
Option -plog will override the name of the partition log files file.N.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="o">-</span><span class="n">nocite</span>
</pre></div>
</div>
<p>Disable writing the log.cite file which is normally written to list
references for specific cite-able features used during a LIGGGHTS(R)-PUBLIC run.
See the <a class="reference external" href="http://lammps.sandia.gov/cite.html">citation page</a> for more
details.</p>
<div class="highlight-python"><div class="highlight"><pre>-partition 8x2 4 5 ...
</pre></div>
</div>
<p>Invoke LIGGGHTS(R)-PUBLIC in multi-partition mode.  When LIGGGHTS(R)-PUBLIC is run on P
processors and this switch is not used, LIGGGHTS(R)-PUBLIC runs in one partition,
i.e. all P processors run a single simulation.  If this switch is
used, the P processors are split into separate partitions and each
partition runs its own simulation.  The arguments to the switch
specify the number of processors in each partition.  Arguments of the
form MxN mean M partitions, each with N processors.  Arguments of the
form N mean a single partition with N processors.  The sum of
processors in all partitions must equal P.  Thus the command
&#8220;-partition 8x2 4 5&#8221; has 10 partitions and runs on a total of 25
processors.</p>
<p>To run multiple independent simulatoins from one input script, using
multiple partitions, see <a class="reference internal" href="Section_howto.html#howto-4"><span>Section_howto 4</span></a>
of the manual.  World- and universe-style <a class="reference internal" href="variable.html"><em>variables</em></a>
are useful in this context.</p>
<div class="highlight-python"><div class="highlight"><pre>-plog file
</pre></div>
</div>
<p>Specify the base name for the partition log files, so partition N
writes log information to file.N. If file is none, then no partition
log files are created.  This overrides the filename specified in the
-log command-line option.  This option is useful when working with
large numbers of partitions, allowing the partition log files to be
suppressed (-plog none) or placed in a sub-directory (-plog
replica_files/log.lammps) If this option is not used the log file for
partition N is log.lammps.N or whatever is specified by the -log
command-line option.</p>
<div class="highlight-python"><div class="highlight"><pre>-pscreen file
</pre></div>
</div>
<p>Specify the base name for the partition screen file, so partition N
writes screen information to file.N. If file is none, then no
partition screen files are created.  This overrides the filename
specified in the -screen command-line option.  This option is useful
when working with large numbers of partitions, allowing the partition
screen files to be suppressed (-pscreen none) or placed in a
sub-directory (-pscreen replica_files/screen).  If this option is not
used the screen file for partition N is screen.N or whatever is
specified by the -screen command-line option.</p>
<div class="highlight-python"><div class="highlight"><pre>-restart restartfile datafile
</pre></div>
</div>
<p>Convert the restart file into a data file and immediately exit.  This
is the same operation as if the following 2-line input script were
run:</p>
<div class="highlight-python"><div class="highlight"><pre>read_restart restartfile
write_data datafile
</pre></div>
</div>
<p>Note that the specified restartfile and datafile can have wild-card
characters (&#8220;*&#8221;,%&#8221;) as described by the
<a class="reference internal" href="read_restart.html"><em>read_restart</em></a> and <a class="reference internal" href="write_data.html"><em>write_data</em></a>
commands.  But a filename such as file.* will need to be enclosed in
quotes to avoid shell expansion of the &#8220;*&#8221; character.</p>
<div class="highlight-python"><div class="highlight"><pre>-reorder nth N
-reorder custom filename
</pre></div>
</div>
<p>Reorder the processors in the MPI communicator used to instantiate
LIGGGHTS(R)-PUBLIC, in one of several ways.  The original MPI communicator ranks
all P processors from 0 to P-1.  The mapping of these ranks to
physical processors is done by MPI before LIGGGHTS(R)-PUBLIC begins.  It may be
useful in some cases to alter the rank order.  E.g. to insure that
cores within each node are ranked in a desired order.  Or when using
the <a class="reference internal" href="run_style.html"><em>run_style verlet/split</em></a> command with 2 partitions
to insure that a specific Kspace processor (in the 2nd partition) is
matched up with a specific set of processors in the 1st partition.
See the <code class="xref doc docutils literal"><span class="pre">Section_accelerate</span></code> doc pages for
more details.</p>
<p>If the keyword <em>nth</em> is used with a setting <em>N</em>, then it means every
Nth processor will be moved to the end of the ranking.  This is useful
when using the <a class="reference internal" href="run_style.html"><em>run_style verlet/split</em></a> command with 2
partitions via the -partition command-line switch.  The first set of
processors will be in the first partition, the 2nd set in the 2nd
partition.  The -reorder command-line switch can alter this so that
the 1st N procs in the 1st partition and one proc in the 2nd partition
will be ordered consecutively, e.g. as the cores on one physical node.
This can boost performance.  For example, if you use &#8220;-reorder nth 4&#8221;
and &#8220;-partition 9 3&#8221; and you are running on 12 processors, the
processors will be reordered from</p>
<div class="highlight-python"><div class="highlight"><pre>0 1 2 3 4 5 6 7 8 9 10 11
</pre></div>
</div>
<p>to</p>
<div class="highlight-python"><div class="highlight"><pre>0 1 2 4 5 6 8 9 10 3 7 11
</pre></div>
</div>
<p>so that the processors in each partition will be</p>
<div class="highlight-python"><div class="highlight"><pre>0 1 2 4 5 6 8 9 10
3 7 11
</pre></div>
</div>
<p>See the &#8220;processors&#8221; command for how to insure processors from each
partition could then be grouped optimally for quad-core nodes.</p>
<p>If the keyword is <em>custom</em>, then a file that specifies a permutation
of the processor ranks is also specified.  The format of the reorder
file is as follows.  Any number of initial blank or comment lines
(starting with a &#8220;#&#8221; character) can be present.  These should be
followed by P lines of the form:</p>
<div class="highlight-python"><div class="highlight"><pre>I J
</pre></div>
</div>
<p>where P is the number of processors LIGGGHTS(R)-PUBLIC was launched with.  Note
that if running in multi-partition mode (see the -partition switch
above) P is the total number of processors in all partitions.  The I
and J values describe a permutation of the P processors.  Every I and
J should be values from 0 to P-1 inclusive.  In the set of P I values,
every proc ID should appear exactly once.  Ditto for the set of P J
values.  A single I,J pairing means that the physical processor with
rank I in the original MPI communicator will have rank J in the
reordered communicator.</p>
<p>Note that rank ordering can also be specified by many MPI
implementations, either by environment variables that specify how to
order physical processors, or by config files that specify what
physical processors to assign to each MPI rank.  The -reorder switch
simply gives you a portable way to do this without relying on MPI
itself.  See the <a class="reference external" href="processors">processors out</a> command for how to output
info on the final assignment of physical processors to the LIGGGHTS(R)-PUBLIC
simulation domain.</p>
<div class="highlight-python"><div class="highlight"><pre>-screen file
</pre></div>
</div>
<p>Specify a file for LIGGGHTS(R)-PUBLIC to write its screen information to.  In
one-partition mode, if the switch is not used, LIGGGHTS(R)-PUBLIC writes to the
screen.  If this switch is used, LIGGGHTS(R)-PUBLIC writes to the specified file
instead and you will see no screen output.  In multi-partition mode,
if the switch is not used, hi-level status information is written to
the screen.  Each partition also writes to a screen.N file where N is
the partition ID.  If the switch is specified in multi-partition mode,
the hi-level screen dump is named &#8220;file&#8221; and each partition also
writes screen information to a file.N.  For both one-partition and
multi-partition mode, if the specified file is &#8220;none&#8221;, then no screen
output is performed. Option -pscreen will override the name of the
partition screen files file.N.</p>
<div class="highlight-python"><div class="highlight"><pre>-var name value1 value2 ...
</pre></div>
</div>
<p>Specify a variable that will be defined for substitution purposes when
the input script is read.  &#8220;Name&#8221; is the variable name which can be a
single character (referenced as $x in the input script) or a full
string (referenced as ${abc}).  An <a class="reference internal" href="variable.html"><em>index-style variable</em></a> will be created and populated with the
subsequent values, e.g. a set of filenames.  Using this command-line
option is equivalent to putting the line &#8220;variable name index value1
value2 ...&#8221;  at the beginning of the input script.  Defining an index
variable as a command-line argument overrides any setting for the same
index variable in the input script, since index variables cannot be
re-defined.  See the <a class="reference internal" href="variable.html"><em>variable</em></a> command for more info on
defining index and other kinds of variables and <span class="xref std std-ref">this section</span> for more info on using variables
in input scripts.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Currently, the command-line parser looks for arguments that
start with &#8220;-&#8221; to indicate new switches.  Thus you cannot specify
multiple variable values if any of they start with a &#8220;-&#8221;, e.g. a
negative numeric value.  It is OK if the first value1 starts with a
&#8220;-&#8221;, since it is automatically skipped.</p>
</div>
<hr class="docutils" />
</div>
<div class="section" id="liggghts-r-public-screen-output">
<span id="start-8"></span><h2><a class="toc-backref" href="#id18">2.8. LIGGGHTS(R)-PUBLIC screen output</a><a class="headerlink" href="#liggghts-r-public-screen-output" title="Permalink to this headline">¶</a></h2>
<p>As LIGGGHTS(R)-PUBLIC reads an input script, it prints information to both the
screen and a log file about significant actions it takes to setup a
simulation.  When the simulation is ready to begin, LIGGGHTS(R)-PUBLIC performs
various initializations and prints the amount of memory (in MBytes per
processor) that the simulation requires.  It also prints details of
the initial thermodynamic state of the system.  During the run itself,
thermodynamic information is printed periodically, every few
timesteps.  When the run concludes, LIGGGHTS(R)-PUBLIC prints the final
thermodynamic state and a total run time for the simulation.  It then
appends statistics about the CPU time and storage requirements for the
simulation.  An example set of statistics is shown here:</p>
<div class="highlight-python"><div class="highlight"><pre>Loop time of 49.002 on 2 procs for 2004 atoms
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>Pair   time (%) = 35.0495 (71.5267)
Bond   time (%) = 0.092046 (0.187841)
Kspce  time (%) = 6.42073 (13.103)
Neigh  time (%) = 2.73485 (5.5811)
Comm   time (%) = 1.50291 (3.06703)
Outpt  time (%) = 0.013799 (0.0281601)
Other  time (%) = 2.13669 (4.36041)
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>Nlocal:    1002 ave, 1015 max, 989 min
Histogram: 1 0 0 0 0 0 0 0 0 1
Nghost:    8720 ave, 8724 max, 8716 min
Histogram: 1 0 0 0 0 0 0 0 0 1
Neighs:    354141 ave, 361422 max, 346860 min
Histogram: 1 0 0 0 0 0 0 0 0 1
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>Total # of neighbors = 708282
Ave neighs/atom = 353.434
Ave special neighs/atom = 2.34032
Number of reneighborings = 42
Dangerous reneighborings = 2
</pre></div>
</div>
<p>The first section gives the breakdown of the CPU run time (in seconds)
into major categories.  The second section lists the number of owned
atoms (Nlocal), ghost atoms (Nghost), and pair-wise neighbors stored
per processor.  The max and min values give the spread of these values
across processors with a 10-bin histogram showing the distribution.
The total number of histogram counts is equal to the number of
processors.</p>
<p>The last section gives aggregate statistics for pair-wise neighbors
and special neighbors that LIGGGHTS(R)-PUBLIC keeps track of (see the
<code class="xref doc docutils literal"><span class="pre">special_bonds</span></code> command).  The number of times
neighbor lists were rebuilt during the run is given as well as the
number of potentially &#8220;dangerous&#8221; rebuilds.  If atom movement
triggered neighbor list rebuilding (see the
<a class="reference internal" href="neigh_modify.html"><em>neigh_modify</em></a> command), then dangerous
reneighborings are those that were triggered on the first timestep
atom movement was checked for.  If this count is non-zero you may wish
to reduce the delay factor to insure no force interactions are missed
by atoms moving beyond the neighbor skin distance before a rebuild
takes place.</p>
<p>The first line lists the initial and final energy, as well as the
energy on the next-to-last iteration.  The next 2 lines give a measure
of the gradient of the energy (force on all atoms).  The 2-norm is the
&#8220;length&#8221; of this force vector; the inf-norm is the largest component.
The last 2 lines are statistics on how many iterations and
force-evaluations the minimizer required.  Multiple force evaluations
are typically done at each iteration to perform a 1d line minimization
in the search direction.</p>
</div>
</div>


           </div>
           <div class="articleComments">
            
           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="Section_input_script.html" class="btn btn-neutral float-right" title="3. Input Script" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="Section_intro.html" class="btn btn-neutral" title="1. Introduction" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2016, DCS Computing GmbH, JKU Linz and Sandia Corporation.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'v3.X',
            LANGUAGE:'None',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true,
            SOURCELINK_SUFFIX: ''
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>